#ifndef PROXY_CONN_FLOW_INSTANCE_H_
#define PROXY_CONN_FLOW_INSTANCE_H_

#include "proxy/base/proxybase.h"

namespace proxy{

  class FlowInstance : public boost::noncopyable,
    public boost::enable_shared_from_this < FlowInstance > {
  public:
    typedef boost::shared_ptr<FlowInstance> Ptr;

    FlowInstance(bool is_connected);
    virtual ~FlowInstance(){
    }
    bool IsConnected() const{ return is_connected_ == true; };
    void SetConnectState(bool is_connected){
      is_connected_ = is_connected;
    }
    void AddUpFlow(int up_flow);
    void AddDownFlow(int down_flow);
    int64_t UpFlow() const { return up_flow_; }
    int64_t DownFlow() const { return down_flow_; }
    static int ResetDownFlow();
  private:
    int64_t up_flow_;
    int64_t down_flow_;
    //static int64_t all_up_flow_;
    static int all_down_flow_;
    boost::mutex up_flow_mutex_;
    boost::mutex down_flow_mutex_;
    bool is_connected_;
  };
}

#endif // PROXY_CONN_FLOW_INSTANCE_H_